﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using Gronia.WPF;
namespace Gronia.Test
{
    /// <summary>
    /// Interaction logic for BusyIndicatorTest.xaml
    /// </summary>
    public partial class BusyIndicatorTest : Window
    {
        public BusyIndicatorTest()
        {
            InitializeComponent();
        }

        private void IsBusy_Checked(object sender, RoutedEventArgs e)
        {
            busy.IsBusy = chk_IsBusy.IsChecked.Value;
        }

        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton button = (RadioButton)sender;
            if (button.Content == null) return;
            switch (button.Content.ToString())
            {
                case "None":
                    {
                        busy.BusyImageType = BusyImageType.None;
                    }
                    break;
                case "Normal":
                    {
                        busy.BusyImageType = BusyImageType.Normal;
                        busy.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/logo.png", UriKind.RelativeOrAbsolute));
                    }
                    break;
                case "Rotate":
                    {
                        busy.BusyImageType = BusyImageType.Rotate;
                        busy.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/logo.png", UriKind.RelativeOrAbsolute));
                    }
                    break;
                case "RotateHorizontal3D":
                    {
                        busy.BusyImageType = BusyImageType.RotateHorizontal3D;
                        busy.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/logo.png", UriKind.RelativeOrAbsolute));
                    }
                    break;
                case "RotateVertical3D":
                    {
                        busy.BusyImageType = BusyImageType.RotateVertical3D;
                        busy.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/logo.png", UriKind.RelativeOrAbsolute));
                    }
                    break;
                case "GIF":
                    {
                        busy.BusyImageType = BusyImageType.GIF;
                        busy.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/loading.gif", UriKind.RelativeOrAbsolute));
                    }
                    break;
            }
        }

        private void RadioButton2_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton button = (RadioButton)sender;
            if (button.Content == null) return;

            switch (button.Content.ToString())
            {
                case "None":
                    {
                        busy.BusyLoadingImageType = BusyLoadingImageType.None;
                    }
                    break;
                case "Normal":
                    {
                        busy.BusyLoadingImageType = BusyLoadingImageType.Normal;
                        busy.BusyLoadingImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/loading2.png", UriKind.RelativeOrAbsolute));
                    }
                    break;
                case "GIF":
                    {
                        busy.BusyLoadingImageType = BusyLoadingImageType.GIF;
                        busy.BusyLoadingImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/loading2.gif", UriKind.RelativeOrAbsolute));
                    }
                    break;
            }
        }
    }
}
